<template>
    <div>
        <div>
            <el-config-provider :locale="zhCn"> <!--《:locale="zhCn 》设置语言-->

                <el-scrollbar height="70vh">
                    <!-- 假别基础 -->
                    <el-row :gutter="24">
                        <el-col :span="24">
                            <div class="grid-content ep-bg-purple-light" style="padding: 15px 0;">
                                <el-form-item label="假别基础" label-position="top"
                                    :style="{ fontSize: '15px', fontWeight: 'bold', borderBottom: '1px dashed #e4e7ed' }">
                                    <div class="progress-bar">
                                        <div class="progress"></div>
                                    </div>
                                </el-form-item>

                            </div>
                        </el-col>

                        <!--  -->
                        <el-col :span="24">
                            <div class="grid-content ep-bg-purple-light"><el-form-item label="请假类型"
                                    label-position="top">
                                    <el-input placeholder="" v-model="formData.leaveType" style="width: 354px;" />
                                </el-form-item>
                            </div>
                        </el-col>

                        <el-col :span="24">
                            <div class="grid-content ep-bg-purple-light"><el-form-item label="请假步长"
                                    label-position="top">
                                    <el-input placeholder="" v-model="formData.leaveLength" style="width: 354px;" />
                                </el-form-item>
                            </div>
                        </el-col>

                        <el-col :span="24">
                            <div class="grid-content ep-bg-purple-light"><el-form-item label="适用范围"
                                    label-position="top">
                                    <el-input placeholder="" v-model="formData.rangeApplication"
                                        style="width: 354px;" />
                                </el-form-item>
                            </div>
                        </el-col>

                        <el-col :span="24">
                            <div class="grid-content ep-bg-purple-light"><el-form-item label="请假说明"
                                    label-position="top">
                                    <el-input v-model="formData.reason" style="width: 633px;" :rows="6" type="textarea"
                                        placeholder="" />
                                </el-form-item>
                            </div>
                        </el-col>

                        <!--  -->
                        <el-col :span="24">
                            <!-- 空白分隔区域 -->
                            <div style="height: 10px; border-top: 0px dashed #e4e7ed; margin: 6px 0;"></div>
                        </el-col>

                        <div class="bottom-submit-bar">
                            <el-button type="primary" @click="onSubmit">提交</el-button>
                        </div>

                    </el-row>
                </el-scrollbar>

            </el-config-provider>
        </div>
    </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import { ElMessage, ElMessageBox } from 'element-plus';
import request from '@/api/request';
import router from '@/router';

let emits = defineEmits(['ref-table']);
let formData = ref({});

let onSubmit = () => {
    console.log(formData.value);
    request({
        url: '/holidayType/insert',
        method: 'post',
        data: formData.value
    }).then(res => {
        ElMessage.primary(res.msg);
        emits('ref-table');
    })
}

</script>

<style scoped>
/* 外层容器，可控制整体条的高度、圆角等 */
.progress-bar {
    height: 6px;
    background-color: #ccebf7;
    border-radius: 3px;
    display: flex;
    width: 100%;
    /* 确保进度条容器宽度占满父容器 */
    overflow: hidden;
    /* 防止子元素溢出 */
}

.progress {
    width: 8%;
    height: 10;
    background-color: #61c3ea;
    border-radius: 3px 0 0 3px;
    transition: width 0.3s ease;
    /* 添加宽度变化的过渡效果 */
}

.bottom-submit-bar {
    /* position: fixed; */
    /* 固定定位 */
    bottom: 0;
    /* 靠底部 */
    left: 0;
    width: 100%;
    background-color: #fff;
    /* 背景色，可根据需求调整 */
    border-top: 1px solid #eaeaea;
    /* 顶部边框，与页面区分 */
    padding: 12px 24px;
    /* 内边距，适配截图里的间距风格 */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* 按钮靠左，可根据实际需求调整 */
    z-index: 10;
    /* 提高层级，避免被其他内容覆盖 */
}
</style>
